package fy.mdm.operator;

import com.seeyon.v3x.services.flow.bean.FlowExport;
import com.seeyon.v3x.services.form.bean.ValueExport;
import fy.form.listen.operate.AForm_Save_Operator;
import fy.form.listen.operate.IFormOperator;
import fy.mdm.bean.PartEditCustomerBean;
import fy.mdm.bean.PartEditCustomerFBBean;
import fy.mdm.dao.FiexdAssetReviewDao;
import fy.mdm.dao.PartEditCustomerDao;
import fy.mdm.dao.PartEditCustomerFBDao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class PartEditCustomerFBOperator extends AForm_Save_Operator implements
        IFormOperator {
    private static Log log = LogFactory.getLog(FiexdAssetReviewDao.class);
    private PartEditCustomerFBBean bean = new PartEditCustomerFBBean();
    @Override
    public String getFormName() {
        return "配件客户修改申请表非玻";
    }
    @Override
    protected void parseOtherField_FirstStep(FlowExport flowExport) {
        bean.setSummaryId(super.formBean.getSummaryId());
        bean.setBillname(flowExport.getFlowTitle());
        bean.setApplier(flowExport.getFlowCreatePerson().getId());
        bean.setTs(flowExport.getFlowCreateTime());
    }
    @Override
    protected void parseValueExport(ValueExport ve) {
        String fieldName = ve.getDisplayName();
        if ("变更后客户名称".equals(fieldName)) {
            bean.setCUSTOME_NAME(ve.getValue());
        }else if("变更后客户系别".equals(fieldName)){
            bean.setCUSTOMER_TYPE(ve.getValue());
        }else if("变更后客户大类".equals(fieldName)){
            bean.setBIG_TYPE(ve.getValue());
        }else if("变更后客户小类".equals(fieldName)){
            bean.setSMALL_TYPE(ve.getValue());
        }else if("变更后客户属性".equals(fieldName)){
            bean.setCUSTOMER_ATTRIBUTE(ve.getValue());
        }else if("变更后客户注册地址".equals(fieldName)){
            bean.setAddress(ve.getValue());
        }else if("变更后收款方国别".equals(fieldName)){
            bean.setCOUNTRY(ve.getValue());
        }else if("变更后信用天数".equals(fieldName)){
            bean.setDAYS(ve.getValue());
        }else if("变更后是否退税".equals(fieldName)){
            bean.setTAX_TYPE(ve.getValue());
        }else if("变更后客户代表".equals(fieldName)){
            bean.setRepresentative(ve.getValue());
        }else if("变更后客户状态".equals(fieldName)){
            bean.setStatus(ve.getValue());
        }
        else if("客户编码".equals(fieldName)){
            bean.setCUSTOME_CODE(ve.getValue());
        }
    }
    @Override
    protected boolean save() {
        try {
            PartEditCustomerFBDao partEditCustomerFBDao = new PartEditCustomerFBDao();
            partEditCustomerFBDao.setPartEditCustomerFBBean(bean);
            return partEditCustomerFBDao.StateReturn();

        } catch (Exception e) {
            e.printStackTrace();
        }finally {

        }
        return success;
    }
}
